struct Solution {}

impl Solution {
  pub fn check_perfect_number(num: i32) -> bool {
      if num == 1 {
          return false;
      }
      let mut now = 1;
      let mut i = 2;
      let mut j = num / 2;
      while i <= j {
          if num % i == 0 {
              now += (i + j);
          }
          i += 1;
          j = num / i;
      }
      now == num
  }
}